#include "ClassContent.h"
#include "Namespace.h"

namespace FunctionViewer {
	void ClassContent::Init(Class* f_class, unsigned long f_id, char* f_type, char* f_funcname, char* f_description) {
		program = f_class->program;
		v_namespace = f_class->v_namespace;
		v_class = f_class;
		prev = f_class->last_content;
		next = NULL;
		if (prev == NULL) f_class->first_content = this;
		else prev->next = this;
		f_class->last_content = this;

		id = f_id;
		type = f_type;
		funcname = f_funcname;
		description = f_description;
		
		++v_namespace->contentcount;
		++v_class->contentcount;
	}

	void ClassContent::DeInit() {
		if (prev == NULL) v_class->first_content = next;
		else prev->next = next;
		if (next == NULL) v_class->last_content = prev;
		else next->prev = prev;
		if (v_class->current_content == this) v_class->current_content = NULL;

		--v_namespace->contentcount;
		--v_class->contentcount;
	}
}